/**
 * 主进程接收信号并作出响应
 * @param {*} ipcMain 
 * @param {*} mainWindow 
 */
module.exports = (ipcMain, mainWindow) => {
  const eventList = {
    "on-fullScreen": () => {
      mainWindow.setFullScreen(!mainWindow.isFullScreen())
      mainWindow.webContents.send('windowSize', mainWindow.isFullScreen() ? 'full' : 'unfull')
    } ,
    "on-close": () => mainWindow.close(),
    "on-min": () => mainWindow.minimize(),
    "on-removeDevTools": () => mainWindow.webContents.closeDevTools(),
    "on-openDevTools": () => mainWindow.webContents.openDevTools()
  }
  for(let key in eventList){
    ipcMain.on(key, eventList[key])
  }
  mainWindow.on('enter-full-screen', () => {
    mainWindow.webContents.send('windowSize', 'full')
  })
  mainWindow.on('unmaximize', () => {
    mainWindow.webContents.send('windowSize', 'unfull')
  })
}